package com.dbms.controller;

import com.dbms.common.annotation.ResponseResult;
import com.dbms.domain.dto.BisModelPsparmsDTO;
import com.dbms.domain.vo.BisModelPsparmsVO;
import com.dbms.service.BisModelPsparmsService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "粒子群参数管理", description = "粒子群参数管理相关接口")
@RestController
@RequestMapping("/bis_model_psparms")
@RequiredArgsConstructor
public class BisModelPsparmsController {

    final BisModelPsparmsService bisModelPsparmsService;

    @Operation(summary = "查询粒子群参数数据", description = "查询粒子群参数数据")
    @GetMapping("/queryByInfo")
    ResponseResult<BisModelPsparmsVO> queryByInfo(){
        return ResponseResult.success(bisModelPsparmsService.queryInfo2());
    }

    @Operation(summary = "添加或修改粒子群参数数据", description = "添加或修改粒子群参数数据")
    @PostMapping("/saveOrUpdate")
    ResponseResult<Boolean> saveOrUpdate(@RequestBody BisModelPsparmsDTO dto){
        return ResponseResult.success(bisModelPsparmsService.saveOrUpdate(dto));
    }

    @Operation(summary = "删除粒子群参数数据", description = "删除粒子群参数数据")
    @DeleteMapping("/deleteById")
    ResponseResult<Boolean> deleteById(@RequestBody List<String> ids){
        return ResponseResult.success(bisModelPsparmsService.deleteById(ids));
    }
}
